﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;

namespace TVManager
{
    /// <summary>
    /// Interaction logic for StatusControl.xaml
    /// </summary>
    public partial class StatusControl : UserControl
    {
        public string StatusText
        {
            get { return statusTextBlock.Text; }
            set { statusTextBlock.Text = value; }
        }
        public bool IsIndeterminate
        {
            get { return StatusProgressBar.IsIndeterminate; }
            set
            {
                this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)delegate()
                {
                    StatusProgressBar.IsIndeterminate = value;
                });
            }
        }
        public double ProgressBarValue
        {
            get { return StatusProgressBar.Value; }
            set
            {
                this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)delegate()
                {
                    StatusProgressBar.Value = value;
                });
            }
        }
        public StatusControl()
        {
            InitializeComponent();
        }
        public void Show()
        {
            this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)delegate()
            {
                StatusProgressBar.IsIndeterminate = true;
                rootLayout.Visibility = Visibility.Visible;
            });
        }
        public void Hide()
        {
            this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)delegate()
            {
                rootLayout.Visibility = Visibility.Collapsed;
            });
        }
    }
}
